<template>
	<view>
		<view class="status-tab-wrap bg-f">
			<view class="tab-wrap uv-tabs-fs-28">
				<uv-tabs  inactiveStyle="color: #666" activeStyle="color: #141414" lineWidth="55rpx" lineHeight="6rpx"
					lineColor="url('/static/tab-item-bg.png') 100% 100%" :list="statusList"
					:current="currentStatusIndex" @change="handleStatusChange"></uv-tabs>
			</view>
		</view>
		<view class="content" v-for="(item,index) in list" :key="index">
			<view class="flex_tit">
				<view class="t1"> {{getDictTypeLable(item)}}</view>
				<view class="t2">{{getAuditStatus(item)}}</view>
			</view>
			<view class="font_flex">
				<view class="items1" v-if="item.recordType == '01'">套餐名称：{{item.packageName}}</view>
				<view class="items1" v-if="item.recordType == '02' || item.recordType =='03'">销售订单号：{{item.orderNumber}}</view>
				<view class="items"  v-if="item.recordType == '01'">充值金额：{{item.amountPayment}}</view>
				<view class="items" v-if="item.recordType == '02' || item.recordType =='03'">收款金额：{{item.amountPayment}}</view>
				<view class="items" v-if="item.recordType == '01'">增值金额：{{item.amountGet}}</view>
				<view class="items" v-if="item.recordType == '02'">抵扣金额：{{item.amountDeduct}}</view>
				<view class="items" v-if="item.recordType == '03'">物流单号：{{item.deliveryNumber?item.deliveryNumber:''}}</view>
				<view class="items">支付凭证：
					<span @click="eyes(item)">查看</span>
				</view>
				<view class="items">收款方式：{{getAccountTypeName(item)}}</view>
				<view class="items">专属客服：{{item.csName}}</view>
				<view class="items">收款日期：{{item.datePayment.slice(0,10)}}</view>
			</view>
		</view>
		<view class="nolist" v-if="nolist">
			暂无更多
		</view>
		<view class="" style="height: 100rpx;">
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				statusList: [{
						status: 0,
						name: '全部',
						recordType:''
					},
					{
						status: 1,
						name: '套餐充值',
						recordType:'01'
					},
					{
						status: 2,
						name: '订单',
						recordType:'02'
					},
					{
						status: 3,
						name: '运费',
						recordType:'03'
					},
				],
				currentStatusIndex: 0,
				imgs: [
					"https://mnt-baiye.oss-cn-beijing.aliyuncs.com/1815962648001638400_%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240708105137.jpg",
					"https://mnt-baiye.oss-cn-beijing.aliyuncs.com/1815962678498422784_a.jpg"
				],
				params: {
					pageNum: 1,
					pageSize: 5,
					recordType: ''
				},
				list: [],
				list1:[],
				list2:[],
				list3:[],
				nolist:false

			};
		},
		computed: {
			getDictTypeLable() {
				return (data) => {
					let infos = ''
					this.list1.forEach(item => {
						if (item.dictValue === data.recordType) {
							infos = item.dictLabel
						}
					})
					return infos
				}
			},
			getAuditStatus() {
				return (data) => {
					let auditStatus = ''
					this.list2.forEach(item => {
						if (item.dictValue === data.auditStatus) {
							auditStatus = item.dictLabel
						}
					})
					return auditStatus
				}
			},
			getAuditStatus() {
				return (data) => {
					let auditStatus = ''
					this.list2.forEach(item => {
						if (item.dictValue === data.auditStatus) {
							auditStatus = item.dictLabel
						}
					})
					return auditStatus
				}
			},
			getAccountTypeName() {
				return (data) => {
					let accountTypeName = ''
					this.list3.forEach(item => {
						if (item.dictValue === data.accountTypeName) {
							accountTypeName = item.dictLabel
						}
					})
					return accountTypeName
				}
			}
		},
		onLoad() {
			this.getlist()
			this.$api.getDictTypeData('self_pay_record_type').then((result) => {
				this.list1 = result.data
			})
			this.$api.getDictTypeData('sys_pay_audit_status').then((result) => {
				this.list2 = result.data
			})
			this.$api.getDictTypeData('sys_price_type').then((result) => {
				this.list3 = result.data
			})
			
		},
		onReachBottom() {
			this.params.pageNum ++
			this.getlist()
			
		},
		methods: {
			getlist(){
				this.$api.postRecordList(this.params).then(res => {
					this.list.push(...res.rows)
					let total = Math.ceil(res.total / this.params.pageSize);
					this.nolist = total == 0
				})
			},
			handleStatusChange(e) {
				console.log(e);
				this.list = []
				this.params.pageNum = 1
				this.params.recordType = e.recordType
				this.getlist()
				
			},
			eyes(item) {
				console.log(item.filePayment.split(','));
				uni.previewImage({
					urls:item.filePayment.split(',')
				});
			}
		}
	}
</script>

<style lang="scss">
	.status-tab-wrap{
		position: sticky;
		top: 0%;
	}
	.nolist {
		text-align: center;
		padding: 100rpx 30rpx;
		font-size: 28rpx;
		color: #666;
	}
	
	.content {
		margin: 20rpx auto;
		width: 710rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 28rpx 30rpx;
		box-sizing: border-box;

		.flex_tit {
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1px solid #eee;
			padding-bottom: 30rpx;

			.t1 {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 30rpx;
				color: #333333;
				line-height: 33rpx;
			}

			.t2 {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				color: #FF6A2F;
				line-height: 33rpx;
			}
		}

		.font_flex {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #434343;

			.items1 {
				margin-top: 20rpx;
				width: 100%;
			}

			.items {
				width: 50%;
				margin-top: 14rpx;

				span {
					color: #FF6A2F;
				}
			}

		}
	}
</style>